package edu.hawaii.ics466.tasks;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import edu.hawaii.ics466.objects.GameInfo;
import edu.hawaii.ics466.objects.Review;

import android.os.AsyncTask;
import android.util.Log;

public class AddReview extends AsyncTask<String, Void, Boolean> {

	@Override
	protected Boolean doInBackground(String... params) {
		String gameName = (params.length > 0) ? params[0] : "";
		String username = (params.length > 1) ? params[1] : "";
		String reviewBody = (params.length > 2) ? params[2] : "";
		String rating = (params.length > 3) ? params[3] : "";

		Map<String, String> requestParams = new HashMap<String, String>();
		requestParams.put("gameName", gameName);
		requestParams.put("username", username);
		requestParams.put("reviewBody", reviewBody);
		requestParams.put("rating", rating);
		String response = Ajax.send("http://the-game-rater.comuf.com/app/add_review.php", requestParams);
		if (response != null) {
			Log.wtf("", response);
			return Boolean.parseBoolean(response);
		}
		return null;
	}
}
